<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <h2>props</h2>
      <child :count="5" user-name="xiaohua" :show="true"></child>
    </div>

    <script src="./lib/Vue3.js"></script>
    <script>
      const { createApp } = Vue;

      const Child = {
        // props可以使用字符串数组的语法
        // props: ["count", "name"],

        // props也可以对象的语法
        // 可以帮助我们做数据类型的检查

        // 自定义属性的名字比较长，建议传的时候用连字符，接受的时候用小驼峰
        props: {
          count: Number,
          userName: String,
          show: Boolean,
        },
        template: `
          <div>
            <div>child子组件</div>
            <p>count: {{ count }}</p>  
            <p>name: {{ userName }}</p>  
            <p>show: {{ show }}</p>  
          </div>
        `,
      };

      createApp({
        data() {
          return {
            // count: 5,
          };
        },
        components: {
          Child,
        },
      }).mount("#app");
    </script>
  </body>
</html>
